<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/inc/taglibs.jsp"%>

<script type="text/javascript">
function submitSearchForm(pi){
	$("#searchForm_pi").val(pi)
	$.ajax({
		cache: true,
		type: "POST",
		url: $('#searchForm').attr('action'),
		data:$('#searchForm').serialize(),// 你的formid
		async: false,
		error: function(request) {
		    alert("Connection error");
		},
		success: function(data) {
		    $("#searchResult").html(data);
		}
	});
}

function createOrUpdateEntity(moduleid){
	if(moduleid == undefined){
		moduleid = 0;
	}
	$.ajax({
	    url: siteServer + '/rms/module/entity.do',
	    data:'moduleid='+moduleid,
	    type: 'GET',
	    dataType: 'html',
	    timeout: 1000,
	    error: function(err){
	        alert('暂时不能创建 ： ' + err);
	    },
	    success: function(html){
	    	$("#main_main").html(html);
	    }
	});
}
function removeEntity(moduleid){
	$.ajax({
	    url: siteServer + '/rms/module/remove.do',
	    data:'moduleid='+moduleid,
	    type: 'GET',
	    dataType: 'json',
	    timeout: 1000,
	    error: function(err){
	        alert('暂时不能创建 ： ' + err);
	    },
	    success: function(html){
	    	if(html.code == 0){
	    		alert('删除成功');
	    	}else{
	    		alert('删除失败');
	    	}
	    	submitSearchForm($("#searchForm_pi").val());
	    }
	});
}
$("#searchList").click(function() {
	var pi='';
	submitSearchForm(pi);
});
$("#createEntity").click(function() {
	createOrUpdateEntity();
}); 
</script>
<div id="mainInner" style="width:100%;height:100%;float:left;overflow:scroll;">
	<h3 class="Hs mb15 hsred">
		<span>查询条件</span>
	</h3>
	<form id="searchForm" name="searchForm" action="<c:url value='/rms/module/search.do'/>">
		<input type="hidden" id="searchForm_pi" name="pi" value=""/>
		<ul class="colunm cmore8 unfold cdg" style="height:50px;">
			<li>
			<label class="tjname fw7">模块名称</label>
			<label>
				<input id="moduleName" type="text" size="10"  value="" name="moduleName" class="bdlg pl5 cdg w150 h20 mh5 pr5" >
			</label>
			</li>
		</ul>
		<dl class="colunm c3T4D8 cdg dl-tar colunmbotton mt10"  style="float:left;">
			<dt></dt>
			<dd style="padding-left:10px;">
			<input id="searchList" class="btn buttonbgorange" type="button" value="查  询">
			<input id="createEntity" class="btn buttonbggray btnchongzhi" type="button" style="margin-left:15px;" value="创 建">
			</dd>
		</dl>
	</form>
	<h3 class="Hs mb10 hsred" style="width:100%;float:left;">
		<span>查询结果</span>
	</h3>
	<div id="searchResult" style="width:100%;float:left;">
	</div>
</div>
